//
//  MNDTopTableViewCell.m
//  minidai
//
//  Created by 谭谭伟 on 2017/5/31.
//  Copyright © 2017年 迷你金服. All rights reserved.
//

#import "MNDTopTableViewCell.h"
#import "MNDFinanceAlertViewController.h"
@interface MNDTopTableViewCell()
@property (weak, nonatomic) IBOutlet UILabel *progressLabel;

@property (weak, nonatomic) IBOutlet UIProgressView *progressView;

@end
@implementation MNDTopTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setDetaiModel:(MNDFinaceDetailModel *)detaiModel {
    _detaiModel = detaiModel;
    [self configContents];
}

- (void)configContents {
    self.borrowTitleLabel.text = self.detaiModel.borrow_title;
    self.borrowYearAprLabel.text = self.detaiModel.borrow_year_apr;
    self.borrowDeadlineLabel.text = [NSString stringWithFormat:@"%@个月",self.detaiModel.borrow_deadline];
 
    NSInteger leastMoneyNum = self.detaiModel.borrow_least_tender.integerValue;
    self.leastMoneyLabel.text = [NSString stringWithFormat:@"%zd元",leastMoneyNum];
    self.remainingableTenderLabel.text = [NSString stringWithFormat:@"%@",self.detaiModel.remainingable_tender];
    self.borrowMoneyLabel.text = [NSString stringWithFormat:@"%@",self.detaiModel.borrow_money];
    self.backWayLabel.text = self.detaiModel.back_way;
    self.borrowStartDateLabel.text = self.detaiModel.borrow_start_date;
    self.borrowReleaseTimeLabel.text = self.detaiModel.borrow_release_time;
    NSString *progressStr = self.detaiModel.borrow_nowProgress;
    CGFloat number = progressStr.integerValue;
    CGFloat progressNum = number/100;
    self.progressView.progress = progressNum;

    if (self.detaiModel.borrow_deadline.integerValue > 2) {
        [self.transferConditionButton setTitle:@"满60天后可转" forState:UIControlStateNormal];
    }else {
        [self.transferConditionButton setTitle:@"短期标不可转" forState:UIControlStateNormal];
    }
    if (self.detaiModel.borrow_nowProgress) {
        NSString *progressStr = self.detaiModel.borrow_nowProgress;
        NSInteger number = progressStr.integerValue;
        //        CGFloat number1 = number;
        NSString *progress = [NSString stringWithFormat:@"%ld",(long)number];
        //        [self.progressViewConstraint setValue:progress forKey:@"multiplier"];
        NSString *precent = @"%";
        self.progressLabel.text = [NSString stringWithFormat:@"%@%@",progress,precent];
    }
    
//    self.describleVC.brrowContent = self.detaiModel.borrow_content;
//    self.describleVC.brrowImg = self.detaiModel.borrow_img;
//    self.financeRecordVC.tender = self.detaiModel.tender;
//    self.tenderInfoVC.creditor = self.detaiModel.creditor;
//    self.transferRecordVC.transfer = self.detaiModel.transfer;
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
